
ifeq ($(m),)
	m=update
endif

#localpath=./Apps/project


91user=lightapp
91host=121.42.30.191
91path=/home/lightapp/tomcat7/logger/webapps/logger/web


115user=lightapp
115host=115.29.39.62
115path=/home/lightapp/tomcat7/logger/webapps/logger/web



push:
	git add . &&\
	git commit -m "$(m)" &&\
	git push origin HEAD

# build:
# 	grunt build

dev:
	../../node_modules/.bin/gulp dev

build:
	rm -rf dist && ../../node_modules/.bin/gulp

# deploy-91: build
# 	@echo "\033[92m-------------------\n正在压缩dist... \033[0m" &&\
# 	tar -czf dist.tar.gz dist &&\
# 	echo "\033[92m-------------------\n正在上传压缩文件... \033[0m" &&\
# 	scp dist.tar.gz $(91user)@$(91host):dist.tar.gz &&\
# 	echo "\033[92m-------------------\n删除本地压缩文件... \033[0m" &&\
# 	rm dist.tar.gz;\
# 	echo "\033[92m-------------------\n服务器端解压并删除压缩包... \033[0m" &&\
# 	ssh -t $(91user)@$(91host) "tar -xzf dist.tar.gz && cp -R dist/* $(91path) && rm -rf dist.tar.gz dist" &&\
# 	echo "\033[92m-------------------\n发布成功!\n------------------- \033[0m" &&\
# 	date &&\
# 	echo '\n'


deploy-115: build do-deploy-115

do-deploy-115:
	@echo "\033[92m-------------------\n正在压缩dist... \033[0m" &&\
	tar -czf dist.tar.gz dist &&\
	echo "\033[92m-------------------\n正在上传压缩文件... \033[0m" &&\
	scp dist.tar.gz $(115user)@$(115host):dist.tar.gz &&\
	echo "\033[92m-------------------\n删除本地压缩文件... \033[0m" &&\
	rm dist.tar.gz;\
	echo "\033[92m-------------------\n服务器端解压并删除压缩包... \033[0m" &&\
	ssh -t $(115user)@$(115host) "tar -xzf dist.tar.gz && cp -R dist/* $(115path) && rm -rf dist.tar.gz dist" &&\
	echo "\033[92m-------------------\n发布成功!\n------------------- \033[0m" &&\
	date &&\
	echo '\n'
